<?php
$file=basename(__FILE__, '.php');
include "../Lib/pivote.php";
ruta($file);
include "../Lib/class.fncReportes.php";
include "../Lib/class.session.php";
//include "../Lib/class.setter.php";

$reporte=new fncReportes(Srv,Usr,Pass,base);
$session= new session();
//$usuario=new setter();
//print_r($_SESSION);

?>
<script language="javascript" src="../js/prototype.js" type="text/javascript"></script>
<script language="javascript" src="../js/form.js" type="text/javascript"></script>
<script language="javascript" src="reportes/js/validaciones.js" type="text/javascript"></script>
<link href="../../Lib/css/estilos.css" rel="stylesheet" type="text/css">

<?php if ($_SESSION['perfil'] != 4) { ?>
    <form name="test" action="">
<?php } ?>
<table width="750" align="center" class="datos">

<tr bgcolor="#F8B145"> <td colspan="2" align="center" class="Titulos"> DESCARGA DE DATOS DE PACIENTES</td></tr>
<tr><td>
        <?php  if($_SESSION['perfil'] == 5 || $_SESSION['perfil'] == 6 ||  $_SESSION['perfil'] == 7 || ($_SESSION['perfil'] == 4 && $_SESSION['idunidad'] == 33)) {?>
    ENTIDAD:
        <?php
        echo $reporte->cmbEstado('', '', '','');
         }
      else
      { ?>  <input name="nEstado" type="hidden" value="<?php echo $_SESSION['iddelegacion']; ?>"> <?php } ?>
 
    </td><td>
    <?php  if($_SESSION['perfil'] == 5 || ($_SESSION['perfil']== 4 && $_SESSION['idunidad'] == 33) || $_SESSION['perfil'] == 3) {?>
     INSTITUCIONES:
        <?php
        echo $reporte->cmbSector('', '', '', '');
         }
  else
  { ?>  <input name="nSector" type="hidden" value="<?php echo $_SESSION["idsector"]; ?>"> <?php } ?>
</td>
</tr>

<tr>
    <td align="left"><label><input type="checkbox" checked name="dat_gen" id="dat_gen" />DATOS GENERALES</label></td>
  <td align="left"><input type="checkbox" checked name="dat_sin" id="dat_sin" />SINTOMAS</td>
</tr>
<tr>
  <td align="left"><input type="checkbox" checked name="dat_com" id="dat_com" />COMORBILIDAD</td>
  <td align="left"><label><input type="checkbox" checked name="dat_cli" id="dat_cli" /></label>DATOS CLINICOS</td>
</tr>
<tr>
  <td align="left"><input type="checkbox" checked name="dat_tra" id="dat_tra" />TRATAMIENTO </td>
  <td align="left"><label><input type="checkbox" checked name="dat_epi" id="dat_epi" /></label>DATOS EPIDEMIOLOGICOS</td>
</tr>
<tr>
  <td align="left"><label><input type="checkbox" checked name="dat_lab" id="dat_lab" /></label>LABORATORIO</td>
  <td align="left"><label><input type="checkbox" name="dat_res" id="dat_res" /></label>MUESTRAS</td>
</tr>
<tr>
  <td colspan="2" align="left"><div style="padding-left: 175px;">&nbsp;<span>dd/mm/yyyy</span>&nbsp;<span style=" padding-left: 40px;">dd/mm/yyyy</span></div></td>
</tr>
<tr>
  <td colspan="2" align="left"><label>
      <input type="radio" name="btnFechas" onclick="javascript: document.test.opcFechas.value=1; document.test.fInicialRes.disabled=true; document.test.fFinalRes.disabled=true; document.test.fInicial.disabled=false; document.test.fFinal.disabled=false; document.test.fInicialRes.value=''; document.test.fFinalRes.value='';">
      FECHA DE INICIO DE SINTOMAS DEL</label>
      <input name="fInicial" type="text" class="datos" id="fInicial" onkeyup="this.value=formateafecha(this.value);" size="10" /> 
      AL <input name="fFinal" type="text" class="datos" id="fFinal" onkeyup="this.value=formateafecha(this.value);" size="10" />
  </td>
</tr>
<tr>
  <td colspan="2" align="left"><label>
      <input type="radio" name="btnFechas" onClick="javascript: document.test.opcFechas.value=2; document.test.fInicial.disabled=true; document.test.fFinal.disabled=true; document.test.fInicialRes.disabled=false; document.test.fFinalRes.disabled=false; document.test.fInicial.value=''; document.test.fFinal.value='';">
      FECHA DE RESULTADOS DEL
      <input name="fInicialRes" type="text" class="datos" id="fInicialRes" onkeyup="this.value=formateafecha(this.value);" size="10" />
      AL <input name="fFinalRes" type="text" class="datos" id="fFinalRes" onkeyup="this.value=formateafecha(this.value);" size="10" /></label>
  </td>
</tr>
<tr><td>&nbsp;<input type="hidden" name="opcFechas"></td></tr>
<tr>
   <td align="left">
       <div align="center">
          <a href='#' onclick="validadescargabd('reportes/descargaBD.php?opFechas='+ document.test.opcFechas.value +'&fInicialRes='+ document.test.fInicialRes.value +'&fFinalRes=' + document.test.fFinalRes.value + '&fInicial='+ document.test.fInicial.value +'&fFinal=' + document.test.fFinal.value + '&dat_gen='+ document.test.dat_gen.checked + '&dat_sin=' + document.test.dat_sin.checked + '&dat_com=' + document.test.dat_com.checked + '&dat_tra=' + document.test.dat_tra.checked + '&dat_cli=' + document.test.dat_cli.checked + '&dat_epi=' + document.test.dat_epi.checked + '&dat_lab=' + document.test.dat_lab.checked + '&dat_res=' + document.test.dat_res.checked + '&formato=txt&<?php echo "perfil=".$_SESSION['perfil']."&idsector=";?>' + document.test.nSector.value + '&identidad=' + document.test.nEstado.value,'','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=508, height=365, top=85, left=140')">DESCARGAR TXT (PIPES)</a>
    </div>
  </td>
  <td colspan="2" align="left">
      <div align="center">         
          <a href='#' onclick="window.open('reportes/descargaBD.php?opFechas='+ document.test.opcFechas.value +'&fInicialRes='+ document.test.fInicialRes.value +'&fFinalRes=' + document.test.fFinalRes.value + '&fInicial='+ document.test.fInicial.value +'&fFinal=' + document.test.fFinal.value + '&dat_gen='+ document.test.dat_gen.checked + '&dat_sin=' + document.test.dat_sin.checked + '&dat_com=' + document.test.dat_com.checked + '&dat_tra=' + document.test.dat_tra.checked + '&dat_cli=' + document.test.dat_cli.checked + '&dat_epi=' + document.test.dat_epi.checked + '&dat_lab=' + document.test.dat_lab.checked + '&dat_res=' + document.test.dat_res.checked + '&formato=xls&<?php echo "perfil=".$_SESSION['perfil']."&idsector=";?>' + document.test.nSector.value + '&identidad=' + document.test.nEstado.value,'','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=508, height=365, top=85, left=140')">DESCARGAR EXCEL</a>
      </div>
  </td>
</tr>
<TR>
<td colspan="2"><div id='divDet'></div></td>
</TR>
</table>
<?php if ($_SESSION['perfil'] != 4) { ?>
    </form>
<?php } ?>